package com.example.demo2_review.design_pattern.concurrency_patterns.producer_consumer_Pattern;

import static com.example.demo2_review.pojo.common.BaseConstants1.NUM_FIVE;

/**
 * @Author zwp14
 * @create 2024/6/25 1:37
 * @description
 */
public record Producer(
        Buffer1 buffer1) implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i < NUM_FIVE; i++) {
            try {
                buffer1.product(i);
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
